#include "Arduino.h"

#include "IRjam.h"
#include "IRremoteInt.h"

#define US (1000000 / F_INTERRUPTS)
#define RECV_PIN 2

static uint16_t
bitsrevervse (uint16_t x, uint8_t len);

extern IRjam irJam;

extern volatile irparams_t irparams;


void setup()
{
  Serial.begin(115200);
  Serial.println("Moieen.");
  delay(20); /* make sure the greeting string is out before starting */                                                                                                                                                            
  
  /**
   * raw data sent over the wire: 0x02FCB04F
   *    - address: 02FC
   *    - command: B0
   * Note: according to the protocol the bits have to be reversed, but we 
   * just process it like sent over the air
   */
  //irJam.set_filter_NEC(0x02, 0xB0); 
  //irJam.set_filter_NEC(0, 0xB0); // jam "close" command of DVD player
  //irJam.set_filter_NEC(0, 0x48); // jam Power on/off command of the DVD Player
  irJam.set_filter_NEC(0,0x4F);
  irJam.start(); // start timer and ISR() which handles jamming
}

void loop() {
/*
    for (int i=0; i<RAWBUF; i++) {
        Serial.print(irparams.rawbuf[i]);
        Serial.print(" ");
    }
    Serial.println("");
    delay(500);
    */
}

